cmake_minimum_required (VERSION 2.6)

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
PROJECT(BubblesOS CXX C ASM)

set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")

set(KINCLUDES "-DKERNEL -I. -I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/kernel -I${CMAKE_SOURCE_DIR}/lib/stdc/include -I${CMAKE_SOURCE_DIR}/lib/stdcxx/include -I${CMAKE_SOURCE_DIR}/lib/elf/include -I${CMAKE_SOURCE_DIR}/lib/plosdk/core")
IF(X86)
	SET(KINCLUDES "${KINCLUDES} -DX86")
ENDIF(X86)
IF(X86_COMMON)
	SET(KINCLUDES "${KINCLUDES} -DX86_COMMON")
ENDIF(X86_COMMON)

SET(PIT_MODULE_SRC
	main.cpp
)

SET(CMAKE_CXX_COMPILE_OBJECT "${gplusplus} ${KFLAGS} ${WFLAGS} ${OPTIMIZEFLAGS} ${KINCLUDES} -c -o <OBJECT> <SOURCE>")
SET(CMAKE_C_COMPILE_OBJECT "${gcc} ${KCFLAGS} ${WFLAGS} ${OPTIMIZEFLAGS} ${KINCLUDES} -c -o <OBJECT> <SOURCE>")
SET(CMAKE_ASM_COMPILE_OBJECT "nasm -f elf <FLAGS> -o <OBJECT> <SOURCE>")
SET(CMAKE_AR "${gar}")
SET(CMAKE_RANLIB "${granlib}")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r  <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
SET(CMAKE_CXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
SET(CMAKE_CXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})

#-T${CMAKE_SOURCE_DIR}/${LD_FILE}
SET(CMAKE_CXX_LINK_EXECUTABLE "${ld} -r <OBJECTS> -o <TARGET>")

add_executable( pit.ko ${PIT_MODULE_SRC} )
